package edu.colorado.cs

import akka.stm._

abstract class Project {
  // TransactionalMap is a special kind of Map that has the STM
  // (Software Transactional Memory) operations behind the scenes. It
  // stores the input data as the key and the result as the value. If
  // the result for a given input value hasn't been computed yet, the
  // value is None.
  val data = TransactionalMap[Double, Option[Double]]

  // This function populates the TransactionalMap. It should be called
  // only once.
  def init_data()

  // This function is called every time a client requests data from the
  // server. It should return None if there's no more data to send out or
  // Some(value: Double), where value is the data to be operated on.
  def split_data(): Option[Double]

  // This function should take all of the results in the TransactionalMap
  // and compute an overall final result.
  def recombine_data()

  // This function should take the input data and result and store it in
  // the TransactionalMap.
  def add_result(in: Double, result: Double)
}
